Skip to content

Fix integer type in binary_code_transform#1356

Merged
mhucka merged 1 commit into
quantumlib:mainfrom
JdelArco98:tapered_binary_fix
Jun 10, 2026
Merged

Fix integer type in binary_code_transform#1356
mhucka merged 1 commit into
quantumlib:mainfrom
JdelArco98:tapered_binary_fix

Conversation

@JdelArco98

Copy link
Copy Markdown
Contributor

on openfermion/transforms/opconversions/binary_code_transform.py line 163 it breaks (with numpy>2.) because (-1) ** updated_parity being updated_parity numpy.count_nonzero(fermionic_indices[:op_idx] < op_tuple[0]) line 146 (therefore a numpy.int) is not instance of int, as it is checked on openfermion/ops/operators/symbolic_operator.py line 124

@google-cla

google-cla Bot commented Jun 10, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the binary_code_transform function in binary_code_transform.py to cast updated_parity to an integer when calculating the parity sign exponent, preventing potential type-related issues. There are no review comments, so I have no feedback to provide.

@mhucka mhucka changed the title tapered binary fix int typing Fix integer type in binary_code_transform Jun 10, 2026

@mhucka mhucka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching and fixing this!

@mhucka mhucka added this pull request to the merge queue Jun 10, 2026
Merged via the queue into quantumlib:main with commit 0f40a41 Jun 10, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants